//两数之和
//https://leetcode.cn/problems/two-sum/description/
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) 
    {
        unordered_map<int, int> _map;
        int n = nums.size();
        for (int i = 0; i < n; ++i) 
        {
            auto it = _map.find(target - nums[i]);
            if (it != _map.end()) 
            {
                return {it->second, i};
            }
            _map[nums[i]] = i;
        }
        return {};
    }
};
